package com.soilflow.web.controller.games;

import com.soilflow.common.annotation.Log;
import com.soilflow.common.core.controller.BaseController;
import com.soilflow.common.core.domain.AjaxResult;
import com.soilflow.common.core.domain.entity.GamesInfo;
import com.soilflow.common.core.page.TableDataInfo;
import com.soilflow.common.enums.BusinessType;
import com.soilflow.know.service.GamesInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/games/info")
public class GamesInfoController extends BaseController {

    @Autowired
    private GamesInfoService gamesInfoService;

    /**
     * 查询大湖百事通列表
     */
    //    @PreAuthorize("@ss.hasPermi('land:info:list')")
    @GetMapping("/list")
    public TableDataInfo list(GamesInfo landInfo)
    {
        startPage();
        List<GamesInfo> list = gamesInfoService.selectGamesInfoList(landInfo);
        return getDataTable(list);
    }



    /**
     * 查询大湖百事通下拉列表
     */
    @GetMapping("/all")
    public AjaxResult listAll(GamesInfo landInfo)
    {
        List<GamesInfo> list = gamesInfoService.selectGamesInfoList(landInfo);
        return AjaxResult.success(list);
    }

    /**
     * 获取大湖百事通详细信息
     */
    //    @PreAuthorize("@ss.hasPermi('land:info:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(gamesInfoService.selectGamesInfoById(id));
    }

    /**
     * 新增大湖百事通
     */
    //    @PreAuthorize("@ss.hasPermi('land:info:add')")
    @Log(title = "大湖百事通", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody GamesInfo landInfo)
    {
        return toAjax(gamesInfoService.insertGamesInfo(landInfo));
    }

    /**
     * 修改大湖百事通
     */
    //    @PreAuthorize("@ss.hasPermi('land:info:edit')")
    @Log(title = "大湖百事通", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody GamesInfo landInfo)
    {
        return AjaxResult.success(gamesInfoService.updateGamesInfo(landInfo));
    }

    /**
     * 删除大湖百事通
     */
    //    @PreAuthorize("@ss.hasPermi('land:info:remove')")
    @Log(title = "大湖百事通", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable List<Long> ids)
    {
        return toAjax(gamesInfoService.removeByIds(ids));
    }

}
